package qc.module.platform.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import qc.module.platform.dto.config.group.ConfigGroupDto;
import qc.module.platform.dto.config.group.ConfigGroupQueryConditionDto;
import qc.module.platform.service.ProjectConfigGroupsService;

import java.util.List;

/**
 * ConfigGroupController
 *
 * @author QuCheng Tech
 * @create 2023/1/9
 */
@RestController
@RequestMapping("/cfggrp")
public class ConfigGroupController {
    private ProjectConfigGroupsService projectConfigGroupsService;

    @Autowired
    public void setProjectConfigGroupsService(ProjectConfigGroupsService projectConfigGroupsService) {
        this.projectConfigGroupsService = projectConfigGroupsService;
    }

    /**
     * 根据条件查询分组信息
     *
     * @param dto ConfigGroupQueryConditionDto
     * @return 分组信息
     * @author QcCheng Tech
     * @since 2023/2/8
     */
    @RequestMapping(value = "/getallbygroup", method = {RequestMethod.GET, RequestMethod.POST})
    public List<ConfigGroupDto> getAllByGroupCode(@RequestBody ConfigGroupQueryConditionDto dto) throws Exception {
        return projectConfigGroupsService.getAllByGroupCodeAndProjectCode(dto);
    }
}
